package com.pz.gulimall.auth.controller;

import com.pz.gulimall.auth.service.RegistService;
import com.pz.gulimall.auth.vo.req.UserRegistReqVo;
import com.pz.gulimall.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 客户端用户注册
 */
@RestController
public class RegisterController {
    @Autowired
    private RegistService registService;

    @GetMapping("/register/get-checkcode/{phoneNumber}")
    public R getCheckCode(@Valid  @PathVariable String phoneNumber){
        return registService.getCheckCode(phoneNumber);
    }

    @PostMapping("/register/submit")
    public R submitRegister(@Valid @RequestBody UserRegistReqVo registReqVo){
        return registService.submitRegister(registReqVo);
    }
}
